local ServiceLayer = class("ServiceLayer", require "widget/BaseUI")
 
function ServiceLayer.show()
    print("============ServiceLayer.show===============")
 
    local win = ServiceLayer.new()

    local data = getWndInitParamList()
    data.isRemoveResource = false
    data.imgTitle = nil
    data.bgImage = nil
    data.isShowCover = false,

    win:init(data)
    win:showWindow()

    return win

end

function ServiceLayer:ctor() 
    ServiceLayer.super:ctor();
end


function ServiceLayer:init(data)
    self:initWithParas(data)
    
    self.m_Json = ccs.GUIReader:getInstance():widgetFromJsonFile("image/ui/Json/LayerService.json")
    self:setContentSize(self.m_Json:getContentSize())
    self.m_Json:setPositionX(-self.m_Json:getContentSize().width/2)
    self.m_Json:setPositionY(-self.m_Json:getContentSize().height/2)
    self:addChild(self.m_Json)
    
    self.m_LabelWeiXin = self.m_Json:getChildByName("Label_WeiXin")  --微信公众号
    self.m_LabelQQ = self.m_Json:getChildByName("Label_QQ") 
    self.m_LabelTel = self.m_Json:getChildByName("telephone") 
    self.m_LabelAward = self.m_Json:getChildByName("Label_Award")  -- 奖励：X金币
    self.m_LabelLoadx = self.m_Json:getChildByName("Label_Loadx")  -- 连续登陆X天
    
    
    self.m_BtnGuanWang = ccui.Helper:seekWidgetByName(self.m_Json,"service_official")
    self.m_BtnGuanWang:setTouchEnabled(true)
    self.m_BtnGuanWang:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnClose = ccui.Helper:seekWidgetByName(self.m_Json,"service_close")
    self.m_BtnClose:setTouchEnabled(true)
    self.m_BtnClose:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
 
  
end


function ServiceLayer:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        if sender == self.m_BtnGuanWang then     
            print "=========ServiceLayer:onMenutClick m_BtnGuanWang======================="
        elseif sender == self.m_BtnClose then     
            print "=========ServiceLayer:onMenutClick m_BtnClose======================="
            self:closeWindow()
        end
    end
end
 
return ServiceLayer